package com.lh.pospi.x_store.adapter;

import android.support.annotation.Nullable;
import android.view.View;
import android.widget.CheckBox;
import android.widget.CompoundButton;

import com.chad.library.adapter.base.BaseQuickAdapter;
import com.chad.library.adapter.base.BaseViewHolder;
import com.lh.pospi.x_store.R;
import com.lh.pospi.x_store.modle.TypeBean;

import java.util.List;

public class DeleteAdapter extends BaseQuickAdapter<TypeBean,BaseViewHolder> {
    public DeleteAdapter(int layoutResId, @Nullable List<TypeBean> data) {
        super(layoutResId, data);
    }

    @Override
    protected void convert(BaseViewHolder helper, final TypeBean item) {
        helper.setText(R.id.tv_name, item.getName());
        CheckBox box = helper.getView(R.id.cb_check);
        box.setOnCheckedChangeListener(new CompoundButton.OnCheckedChangeListener() {
            @Override
            public void onCheckedChanged(CompoundButton compoundButton, boolean b) {
                item.setCheck(b);
            }
        });
        box.setChecked(item.isCheck());
    }
}
